//! \file       backtacer.h
//! It contains backtrace structure definitian and backtracer function
//! prototypes.
//! Note you should use backtracer struct only with special backtracer
//! functions. Other ways may fail the program.
//! \brief      Header file of TBG backtracer project.
//! \mainpage
//!
//! \brief      Backtracer application for gen backtrace on ARM.
//!
//! \version    [Version 0.01 alpha, build 1]
//! \author     Copyright (C) onponomarev,
//!             2012-09 (Oleg Ponomarev <onponomarev@parallels.mipt.ru>)
//! \date       2012
//!
//! \warning  - This is the first alpha version therefore it is not stable!

#include "map_utils.h"

//------------------------------------------------------------------------------

#ifndef _BACKTRACER_H_
#define _BACKTRACER_H_

//------------------------------------------------------------------------------

#define DEFAULT_TRACE_SIZE 1024

//------------------------------------------------------------------------------

typedef struct {
    int *trace_idx;
    addr_t *trace_addr;
    size_t trace_size;
} trace_struct;

//------------------------------------------------------------------------------

TBGError DefaultBacktrace(func_map *pmap, void *frame_begin, void *curr_addr);

void PrintBacktrace(func_map *pmap, trace_struct *stack_trace); 

TBGError GenBacktraceFrames(func_map *pmap, void *frame_begin, void *curr_addr, 
                            void *stop_addr, trace_struct *stack_trace,
                            size_t trace_max_size);

//------------------------------------------------------------------------------

#endif //_BACKTRACER_H_
